﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Shared/Columns.Master" AutoEventWireup="true"
    CodeBehind="ViewGroup.aspx.cs" Inherits="SharingCenter.Web.Mod.Groups.ViewGroup"
    EnableEventValidation="false" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitlePlaceHolder" runat="server">
    <asp:Literal ID="ltrTitle" runat="server"></asp:Literal>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
    <style>
        .desc p
        {
            margin-top: 0;
        }
        .threadhead th, .threadtitle td
        {
            height: 30px;
            vertical-align: middle;
            border-bottom: 1px dashed silver;
        }
        .threadfoot td
        {
            height: 30px;
            vertical-align: middle;
        }
        
        #ghead tr.d td{color:gray;}
        #ghead td.l{width:15%;}
    </style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
    <script type="text/javascript">
        var groupid = '<%=groupId %>';
        var groupname = '<%=group.GroupName %>';
    </script>
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
        <Scripts>
            <asp:ScriptReference Path="~/Mod/Groups/ViewGroup.js" />
        </Scripts>
    </asp:ScriptManagerProxy>
    <asp:ListView runat="server" DataKeyNames="GroupId" ID="ListView1" DataSourceID="LinqDataSource1">
        <LayoutTemplate>
            <div runat="server" id="itemPlaceholder" />
        </LayoutTemplate>
        <ItemTemplate>
            <div class="ctn-p-t">
                <div class="fc ctn-p-t">
                    <div class="left">
                        <div class="bdr-all left">
                            <cc:GroupAvatarImage AvatarType="Normal" runat="server" GroupId='<%#Eval("GroupId") %>'
                                AlternateText="圈子头像" />
                        </div>
                    </div>
                    <div class="left ctn-p-l" style="width: 370px; overflow: hidden;">
                        <table id="ghead" class="tb-full">
                            <tr>
                                <td colspan="2">
                                    <h3 class="w5">
                                        <asp:Image ImageUrl="~/Content/images/icons/star_on.png" ToolTip="精华圈子" AlternateText="精华圈子" Visible='<%#Convert.ToBoolean(Eval("IsRecommended")) %>' runat="server" />
                                        <asp:Image ID="Image1" ImageUrl="~/Content/images/icons/fire_on.png" ToolTip="热门圈子" AlternateText="热门圈子" Visible='<%#Convert.ToBoolean(Eval("IsHot")) %>' runat="server" />
                                        <asp:Label CssClass="sz-l" ID="Literal1" runat="server" Text='<%#Eval("GroupName") %>' /></h3>
                                </td>
                            </tr>
                            
                            <tr class="d">
                            
                                <td colspan="3">
                                    <asp:Label Text='<%#Eval("Province") %>' runat="server" />&nbsp;
                                    <asp:Label Text='<%#Eval("City") %>' runat="server" />
                                </td>
                            </tr>
                            <tr class="d">
                                <td class="l">
                                    成员:
                                </td>
                                <td>
                                    <asp:Label ID="Label3" runat="server" Text='<%#Eval("MemberCount", "{0}人") %>' />
                                </td>
                            </tr>
                            <tr class="d">
                                <td class="l">
                                    创建:
                                </td>
                                <td>
                                    <asp:Label ID="Label1" runat="server" Text='<%#Eval("CreateDate", "{0:yyyy年M月d日}") %>' />
                                </td>
                            </tr>
                            <tr class="d">
                                <td class="l">
                                    类别:
                                </td>
                                <td>
                                    <asp:Label ID="Label7" runat="server" Text='<%#Eval("GroupCategory") %>' />
                                </td>
                            </tr>
                            <tr class="d">
                                <td valign="top" class="l">
                                    介绍:
                                </td>
                                <td class="desc">
                                    <div class="textjust">
                                        <asp:Literal ID="Label2" runat="server" Text='<%#Eval("Description") %>' />
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="ctn1">
                    <myuc:GenericTabs runat="server" Section="GroupPage" SelectedItem="1" AddPageQueryString="true" />
                </div>
                <div>
                    <h3 class="w5">
                        圈子动态</h3>
                    <myuc:SiteEventList CssClass="se" runat="server" ID="SiteEventList1" OnLoad="SiteEventList1_Load"
                        AppName="Groups" />
                </div>
                <div>
                    <h3 class="w5">
                        圈子话题</h3>
                    <asp:ListView ID="lvThreadsList" runat="server" InsertItemPosition="None">
                        <LayoutTemplate>
                            <table cellpadding="0" cellspacing="0" class="tb-full">
                                <thead>
                                    <tr class="threadhead">
                                        <th class="fw-n textnear" style="width: 290px;">
                                            标题
                                        </th>
                                        <th class="fw-n textnear ctn-p-r">
                                            <div class="nss ns-eye" title="阅读">
                                            </div>
                                        </th>
                                        <th class="fw-n textnear ctn-p-r">
                                            <div class="nss ns-reply" title="回复">
                                            </div>
                                        </th>
                                        <th class="fw-n textnear" style="width: 100px;">
                                            作者
                                        </th>
                                        <th class="fw-n textnear">
                                            最后更新
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr runat="server" id="itemPlaceholder">
                                    </tr>
                                </tbody>
                            </table>
                        </LayoutTemplate>
                        <ItemTemplate>
                            <tr class="threadtitle">
                                <td>
                                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%#Eval("ThreadId", "Posts/Posts.aspx?t={0}&u=1&id=")+Request.QueryString["id"] %>'
                                        Text='<%#Eval("PostTitle") %>'></asp:HyperLink>
                                </td>
                                <td>
                                    <asp:Label ID="Label5" runat="server" Text='<%#Eval("ViewCount") %>'></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="Label6" runat="server" Text='<%#Convert.ToInt32(Eval("TotalPosts"))-1 %>'></asp:Label>
                                </td>
                                <td>
                                    <cc:NickNameLink runat="server" UserId='<%#Eval("CreatorUserId") %>'></cc:NickNameLink>
                                </td>
                                <td>
                                    <asp:Label ID="ThreadLastUpdate" runat="server" Text='<%#Eval("LastUpdate") %>' OnPreRender="ThreadLastUpdate_PreRender"></asp:Label>
                                </td>
                            </tr>
                        </ItemTemplate>
                        <EmptyDataTemplate>
                            <span class="nss ns-info"></span><span class="litetext iconlabel">目前没有话题。</span>
                        </EmptyDataTemplate>
                    </asp:ListView>
                    <div class="textfar ctn-p-t">
                        <%if (isMember)
                          { %>
                        &raquo;<asp:HyperLink ID="CreateThreadLink" runat="server" NavigateUrl="Posts/CreateThread.aspx?id="
                            OnPreRender="EnterThreadLink_PreRender">发表话题</asp:HyperLink>
                        <%} %>
                        &nbsp;&raquo;<asp:HyperLink ID="EnterThreadLink" runat="server" NavigateUrl="Posts/ThreadList.aspx?id="
                            OnPreRender="EnterThreadLink_PreRender">进入话题区</asp:HyperLink>
                    </div>
                </div>
                <div>
                    <h3 class="w5">
                        圈子活动</h3>
                    <asp:ListView ID="lvEventList" runat="server">
                        <LayoutTemplate>
                            <table cellpadding="0" cellspacing="0" class="tb-full threadhead">
                                <thead class="threadhead">
                                    <tr>
                                        <th class="fw-n textnear" style="width: 290px;">
                                            活动名称
                                        </th>
                                        <th class="fw-n textnear">
                                            <div title="活动时间" class="nss ns-clock">
                                            </div>
                                        </th>
                                        <th class="fw-n textnear">
                                            报名/上限
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr runat="server" id="itemPlaceholder" />
                                </tbody>
                            </table>
                        </LayoutTemplate>
                        <ItemTemplate>
                            <tr class="threadtitle">
                                <td>
                                    <asp:HyperLink ID="HyperLink2" runat="server" Text='<%#Eval("Title")%>' NavigateUrl='<%#Eval("EventId", "~/Mod/Events/View.aspx?id={0}") %>'></asp:HyperLink>
                                </td>
                                <td>
                                    <asp:Label ID="Label8" runat="server" Text='<%#Eval("StartDate") %>' OnPreRender="DateFormat"></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="Label9" runat="server" Text='<%#Eval("TotalParticipants")+"/"+((int)Eval("MaxParticipants")>0?Eval("MaxParticipants"):"无限制") %>'></asp:Label>
                                </td>
                            </tr>
                        </ItemTemplate>
                        <EmptyDataTemplate>
                            <span class="nss ns-info"></span><span class="litetext iconlabel">目前没有活动。</span>
                        </EmptyDataTemplate>
                    </asp:ListView>
                    <div class="textfar ctn-p-t">
                        <%if (isMember)
                          { %>
                        &raquo;<asp:HyperLink ID="CreateEventLink" runat="server" NavigateUrl="Events/Event.aspx?id="
                            OnPreRender="NavigateUrlAddGroupId">发起活动</asp:HyperLink>
                        <%} %>
                        &nbsp;&raquo;<asp:HyperLink ID="EnterEventLink" runat="server" NavigateUrl="Events/?id="
                            OnPreRender="NavigateUrlAddGroupId">全部活动</asp:HyperLink>
                    </div>
                </div>
                <div>
                    <h3 class="w5">
                        留言本</h3>
                    <asp:MultiView runat="server" ID="mvComment" OnPreRender="mvComment_PreRender">
                        <asp:View runat="server">
                            <myuc:CommentControl ID="CommentControl1" runat="server" AppName="Group" ContextName="Home"
                                ContextId='<%#Eval("GroupId") %>' />
                        </asp:View>
                        <asp:View ID="View3" runat="server">
                            <myuc:MessageBox runat="server" ID="msgMemberOnlyComment" Text="只有圈子成员才能发表留言。" />
                        </asp:View>
                    </asp:MultiView>
                </div>
            </div>
        </ItemTemplate>
    </asp:ListView>
    <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="SharingCenter.Web.Classes.scDataContext" 
        TableName="Sc_Groups" Where="GroupId == @GroupId">
        <WhereParameters>
            <asp:QueryStringParameter DbType="Guid" Name="GroupId" QueryStringField="id" />
        </WhereParameters>
    </asp:LinqDataSource>
</asp:Content>
<asp:Content ContentPlaceHolderID="RightSidebarContentPlaceHolder" ID="RightSidebarContentPlaceHolder1"
    runat="server">
    <asp:ListView runat="server" DataKeyNames="GroupId" ID="lvSidebar">
        <LayoutTemplate>
            <div runat="server" id="itemPlaceholder" />
        </LayoutTemplate>
        <ItemTemplate>
            <div>
                <div class="ctn2 normal">
                    <asp:Panel runat="server" ID="pnJoinGroup" OnLoad="pnJoinGroup_Load">
                        <div class="ctn-p-b">
                            <asp:Panel runat="server" Visible='<%#Convert.ToInt16(Eval("Privacy"))==1 %>'>
                                <a class="openmodalformbutton-nostyle addusertogroupbutton">
                                    <img src="images/group.join.png" alt="加入圈子" />
                                </a>
                                <asp:Panel ID="Panel1" runat="server" CssClass="dialogform joingroupdialog" ToolTip='<%#Eval("GroupName", "加入圈子: {0}") %>'>
                                    <div style="width: 300px;" class="ctn2">
                                        <div id="joingroupsuccess" style="display: none">
                                            <div class="ctn-p-b">
                                                <asp:Label runat="server" Text='<%#Eval("GroupName", "你已经成功加入{0}。")%>'></asp:Label></div>
                                            <a href="ViewGroup.aspx?id=<%=Request.QueryString["id"] %>" class="submitbutton">确定</a>
                                        </div>
                                    </div>
                                </asp:Panel>
                            </asp:Panel>
                            <asp:Panel ID="Panel2" runat="server" Visible='<%#Convert.ToInt16(Eval("Privacy"))==2 %>'>
                                <a class="openmodalformbutton-nostyle">
                                    <img src="images/group.join.png" alt="加入圈子" />
                                </a>
                                <asp:Panel ID="Panel3" runat="server" CssClass="dialogform joingroupdialog" ToolTip='<%#Eval("GroupName", "加入圈子: {0}") %>'>
                                   
                                            <div style="width: 500px">
                                                <div id="prerequest">
                                                    <myuc:MessageBox ID="MessageBox2" MessageType="Generic" Text='<%#Eval("GroupName", "{0}的类型属于半公开型，您的申请需要圈主批准，要等到圈主批准后才能加入圈子。") %>'
                                                        runat="server" />
                                                    <strong>入圈须知</strong>
                                                    <div class="ctn2 bdr-all" style="height: 100px; height: auto!important; max-height: 100px;
                                                        overflow: auto">
                                                        <asp:Literal ID="Literal2" runat="server" Text='<%#Eval("Preface") %>'></asp:Literal>
                                                    </div>
                                                    <br />
                                                    <strong>申请留言</strong><br />
                                                    <asp:TextBox CssClass="requestcomment" TextMode="MultiLine" ID="txtJoinComment" runat="server" MaxLength="100"
                                                        Width="400px" Rows="2"></asp:TextBox>
                                                    <div class="actionarea">
                                                        <%--<asp:LinkButton ID="LinkButton1" runat="server" CssClass="submitbutton" CommandName="JoinRequest">确定</asp:LinkButton>
                                                        --%><a class="submitbutton" id="joingrouprequestbutton">确定</a>
                                                        <a class="closemodalformbutton pointer">取消</a>
                                                    </div>
                                                </div>
                                                <div id="postrequest">
                                                    <div>
                                                        圈子请求已经发送给管理员。
                                                    </div>
                                                    <div class="actionarea">
                                                        <a class="submitbutton closemodalformbutton-nostyle pointer">确定</a>
                                                    </div>
                                                </div>
                                            </div>
                                      
                                </asp:Panel>
                            </asp:Panel>
                        </div>
                    </asp:Panel>
                    <h3 class="w7 ">
                        <div class="fc">
                            <div class="left">
                                圈子管理员</div>
                        </div>
                    </h3>
                    <div class="ctn-p-b">
                        <asp:ListView ID="lvAdminList" runat="server" InsertItemPosition="None" GroupItemCount="3">
                            <LayoutTemplate>
                                <table cellspacing="0" cellpadding="0" class="tb-full">
                                    <tr runat="server" id="groupPlaceholder" />
                                </table>
                            </LayoutTemplate>
                            <GroupTemplate>
                                <tr>
                                    <td runat="server" id="itemPlaceholder" />
                                </tr>
                            </GroupTemplate>
                            <ItemTemplate>
                                <td style="width: 33%" valign="top">
                                    <%--<myuc:ThumbAvatar ID="AdminAvatar" runat="server" UserId='<%#Eval("UserId") %>' OnPreRender="AdminAvatar_PreRender" />--%>
                                    <span class="os" uid="<%#Eval("UserId") %>"></span>
                                    <span class="avtb"><span class="uid" title="<%#Eval("UserId") %>"></span></span>
                                </td>
                            </ItemTemplate>
                            <EmptyItemTemplate>
                                <td style="width: 33%">
                                </td>
                            </EmptyItemTemplate>
                        </asp:ListView>
                    </div>
                    <h3 class="w7">
                        <div class="fc">
                            <div class="left">
                                新加入成员</div>
                            <div class="right fw-n">
                                <a href="Members.aspx?id=<%=Request.QueryString["id"] %>">所有成员</a></div>
                        </div>
                    </h3>
                    <div class="ctn-p-b">
                        <asp:ListView GroupItemCount="3" ID="lvGroupMembers" DataKeyNames="GroupId, UserId"
                            runat="server" DataSource='<%#Eval("Sc_GroupMembers") %>'>
                            <LayoutTemplate>
                                <table cellspacing="0" cellpadding="0" class="tb-full">
                                    <tr runat="server" id="groupPlaceholder" />
                                </table>
                            </LayoutTemplate>
                            <GroupTemplate>
                                <tr>
                                    <td runat="server" id="itemPlaceholder" />
                                </tr>
                            </GroupTemplate>
                            <ItemTemplate>
                                <td style="width: 33%" valign="top">
                                    <%--<myuc:ThumbAvatar runat="server" UserId='<%#Eval("UserId") %>' />--%>
                                    <span class="avtb"><span class="uid" title="<%#Eval("UserId") %>"></span></span>
                                </td>
                            </ItemTemplate>
                            <EmptyItemTemplate>
                                <td style="width: 33%">
                                </td>
                            </EmptyItemTemplate>
                        </asp:ListView>
                    </div>
                    <h3 class="w7">
                        <div class="fc">
                            <div class="left">
                                最近来访
                                <asp:Label ID="Label4" CssClass="fw-n litetext" runat="server" Text='<%#Eval("VisitCount", "({0})") %>'></asp:Label></div>
                            <div class="right">
                            </div>
                        </div>
                    </h3>
                    <myuc:VisitList runat="server" CssClass="vh" ItemsPerRow="3" ShowVisitTime="true"
                        ID="VisitList1" ItemLimit="18" EntityType="Group" NoVisitsText="目前没有人访问过这里。"
                        ContextId='<%#Eval("GroupId") %>' />
                </div>
            </div>
        </ItemTemplate>
    </asp:ListView>
</asp:Content>
